﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using Yss.KFlow.Util;
using System.ComponentModel;
namespace Yss.KFlow.Data
{
    /// <summary>
    /// 流程线条，包含直线、单箭头线、双箭头线等
    /// </summary>
   [Serializable ]
    public class Line
    {
        //private int key;

        //public int Key
        //{
        //    get { return key; }

        //}
        private Shape startPic;
        private Shape endPic;
        private bool selected;
        private Dictionary<Point, Point> pLine;
        private Dictionary<Point, Point> oldpLine;       
       
        private List<Point> listP;
        int arrow = 0;

        

        private object tag;
        #region 属性
        /// <summary>
        /// 箭头
        /// </summary>
        public int Arrow
        {
            get { return arrow; }
            set { arrow = value; }
        }

        /// <summary>
        /// 获取或者设置线条连接的开始图形
        /// </summary>
        public Shape StartPic
        {
            get { return startPic; }
            set { startPic = value; }
        }
        /// <summary>
        /// 获取或者设置线条连接的结束图形
        /// </summary>
        public Shape EndPic
        {
            get { return endPic; }
            set { endPic = value; }
        }
        /// <summary>
        /// 获取或者设置线条是否选中状态,默认没有选中
        /// </summary>
        [Browsable (false )]
        public bool Selected
        {
            get { return selected; }
            set { selected = value; }
        }
        /// <summary>
        /// 当前线条的路径(不包含起点和终点)
        /// </summary>
       [Browsable (false )]
        public Dictionary<Point, Point> PLine
        {
            get { return pLine; }
            set { pLine = value; }
        }
        /// <summary>
        /// 获取线条的前一次路径
        /// </summary>
       [Browsable(false)]
       public Dictionary<Point, Point> OldpLine
        {
            get { return oldpLine; }
            set { oldpLine = value; }
        }
         

        /// <summary>
        /// 获取或者设置线条经过的点
        /// </summary>
       [Browsable(false)]
       public List<Point> ListP
        {
            get { return listP; }
            set { listP = value; }
        }
        
        /// <summary>
        /// 保存在线条上的对象
        /// </summary>
        public object Tag
        {
            get { return tag; }
            set { tag = value; }
        }
        #endregion

       /// <summary>
       /// 线条类型构造函数
       /// </summary>
       /// <param name="startPic"></param>
       /// <param name="endPic"></param>
        public Line(Shape startPic, Shape endPic)
        {
            this.startPic = startPic;
            this.endPic = endPic;
            this.selected = false;
            pLine = new Dictionary<Point, Point>();
            oldpLine = new Dictionary<Point, Point>();   
            listP = new List<Point>();          
           
            //startPic.Next = endPic;
            //key = Common.LineKey++;
        }



    }

}
